package com.bmft.project02.string;

import com.bmft.project02.string.impl.LinkedString;

/**
 * Interface of the LinkedString.
 *
 * @author Jarvan
 * @version 1.0
 * @create 2020/9/24 12:55
 */
public interface LinkedStringInterface<E> {
    /**
     * Return the char value of the index.
     *
     * @param index index.
     * @return Return the char value of the index.
     */
    E charAt(int index);

    /**
     * Concat tow LinkedString to a new LinkedString not use the reference,
     * You need copy it and valued a new address.
     *
     * @param linkedString second linkedString .
     * @return new Linked that concat tow LinkedString to a new LinkedString not use the reference
     */
    LinkedString<Character> concat(LinkedString<E> linkedString);

    /**
     * If the LinkedString is empty ,this method will return true.
     *
     * @return this method will return true if the LinkedString is empty
     */
    boolean isEmpty();

    /**
     * Get the length of the String (how many char(Node) in it.)
     *
     * @return length
     */
    int length();

    /**
     * split the String to a small String.
     *
     * @param startIndex start index.
     * @param tailIndex  end index.
     * @return return s subString.
     */
    LinkedString<Character> subString(int startIndex, int tailIndex);
}
